<%-- 
    Document   : pager
    Created on : 2012-10-15, 16:38:28
    Author     : sunny
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<div class="btn-toolbar">
    <div class="btn-group pull-right">
        <input type="button" class="btn disabled" value="总条数:${totalCount}/总页数:${totalPage}-当前页数:${pageNum}">
        <input name="pageNum" value="${pageNum}" type="hidden">
        <input name="totalPage" value="${totalPage}" type="hidden">
        <input type="button" class="btn" value="&lt;&lt;" onclick="first_page()">
        <c:if test="${pageNum <=3}">
        	<c:set var="begin" value="1"></c:set>
        	<c:set var="end" value="5"></c:set>
        </c:if>
        <c:if test="${pageNum>3 }">
        	<c:if test="${(pageNum+2)<totalPage }">
        		<c:set var="begin" value="${pageNum-2 }"></c:set>
        		<c:set var="end" value="${pageNum+2 }"></c:set>
        	</c:if>
        	<c:set var="begin" value="${pageNum-2 }"></c:set>
        	<c:if test="${(pageNum+2)>=totalPage }">
        		<c:set var="begin" value="${totalPage-4 }"></c:set>
        		<c:set var="end" value="${totalPage }"></c:set>
        	</c:if>
        </c:if>
           <c:forEach begin="${begin }" step="1" var="var" end="${end}">
               <c:if test="${totalPage>=var}">
               	   <c:if test="${var==pageNum }">
               	   		<input type="button" class="btn btn-success" value="${var}" onclick="goPage(${var})">
               	   </c:if>
               	   <c:if test="${var!=pageNum }">
						<input type="button" class="btn" value="${var}" onclick="goPage(${var})">               	   
               	   </c:if>
               </c:if>
           </c:forEach>
        <input type="button" class="btn" value=">>" onclick="last_page()">
    </div>
</div>
